﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using LongQuanWeb.App_Code;

namespace LongQuanWeb
{
    public partial class _Default : System.Web.UI.Page
    {
        public string QQ1 = "";
        public string QQ2 = "";
        public string QQ3 = "";
        public string QQ4 = "";
        public string strSession = "";
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                //如果登录，则将Session传到前台
                if (Session["UserID"] != null)
                {
                    strSession = Session["UserID"].ToString().Trim();
                }
                string strSql = "select * from [QQInfo] where ID=1";
                DataTable dt = DbHelperSQL.Query(strSql).Tables[0];
                QQ1 = dt.Rows[0]["QQ1"].ToString().Trim();
                QQ2 = dt.Rows[0]["QQ2"].ToString().Trim();
                QQ3 = dt.Rows[0]["QQ3"].ToString().Trim();
                QQ4 = dt.Rows[0]["QQ4"].ToString().Trim();
                this.lbl_QQ1.Text = dt.Rows[0]["Name1"].ToString().Trim();
                this.lbl_QQ2.Text = dt.Rows[0]["Name2"].ToString().Trim();
                this.lbl_QQ3.Text = dt.Rows[0]["Name3"].ToString().Trim();
                this.lbl_QQ4.Text = dt.Rows[0]["Name4"].ToString().Trim();
                //绑定新闻rpt
                BindNews();
                //绑定政策新闻rpt
                BindPolicy();
            }
        }

        private void BindNews()
        {
            string strSql = "select Top 6 * from [Activity] Where SubCategoryType='1' Order By AcitivityNum Desc";
            DataTable dt = DbHelperSQL.Query(strSql).Tables[0];
            this.rpt_new.DataSource = dt;
            this.rpt_new.DataBind();
        }

        private void BindPolicy()
        {
            string strSql = "select Top 6 * from [Policy] Order By ID Desc";
            DataTable dt = DbHelperSQL.Query(strSql).Tables[0];
            this.rpt_policy.DataSource = dt;
            this.rpt_policy.DataBind();
        }
    }
}
